<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/9/28 0028
  Time: 上午 10:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <script src="../../js/jquery-3.3.1.min.js" charset="utf-8"></script>
    <script src="../../js/cookie/jquery.cookie.js" charset="utf-8"></script>
    <script src="../../layui-v2.2.5/layui/layui.js" charset="utf-8"></script>
    <script src="/js/layui/form_verify.js"></script>
    <link rel="stylesheet" href="../../layui-v2.2.5/layui/css/layui.css" media="all">

</head>
<body>
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right;margin-right: 100px"  href="javascript:location.replace(location.href);" title="刷新">
    <i class="layui-icon" style="line-height:30px">ဂ</i></a>
<br/><br/><br/>
<table class="layui-hide" id="test" lay-filter="tabTest"></table>
<div id="page" style="margin-left:30%"></div>
<script type="text/html" id="moneyStatistics">
    <a class="layui-btn layui-btn-xs" lay-event="moneyStatistics">资金详情</a>
</script>
<script type="text/html" id="orderStatistics">
    <a class="layui-btn layui-btn-xs" lay-event="orderStatistics">订单详情</a>
</script>
<script type="text/html" id="memberStatistics">
    <a class="layui-btn layui-btn-xs" lay-event="memberStatistics">会员详情</a>
</script>
<%--<script type="text/html" id="couponStatistics">
    <a class="layui-btn layui-btn-xs" lay-event="couponStatistics">优惠券详情</a>
</script>--%>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use('table', function(){
        var table = layui.table;

        table.render({
            elem: '#test'
            ,url:'/marketing/statisticsData'
            ,cols: [[
                {field:'id', width:80, title: 'ID', }
                ,{field:'activityName', width:280, title: '活动名称'}
                ,{field:'orgName', width:280, title: '机构名称', }
                ,{field:'right', width:280, title: '资金统计', toolbar: '#moneyStatistics' }
                ,{fixed: 'right', width:178,title: '订单统计',  toolbar: '#orderStatistics'}
                ,{fixed: 'right', width:178,title: '会员统计',  toolbar: '#memberStatistics'}
                /*,{fixed: 'right', width:178,title: '优惠券统计',  toolbar: '#couponStatistics'}*/
            ]]
            ,page: true
        });

        //监听行单击事件
        table.on('tool(tabTest)', function(obj){
            console.log(obj);
            var data = obj.data;
            console.log(data);
            if (obj.event=="memberStatistics"){//点击会员详情,弹出会员详情
                layer.open({
                    title:'会员详情',
                    type: 2,
                    content: '/marketing/statisticsMember?activityId='+data.id+"&key=",
                    offset: '5px',
                    shade:[0.8, '#393D49'],
                    shadeClose:true,
                    area: ["90%","90%"]
                });
            }else if(obj.event=='orderStatistics'){//订单统计
                layer.open({
                    title:'订单详情',
                    type: 2,
                    content: '/marketing/statistcsOrder?activityId='+data.id+"&key=",
                    offset: '5px',
                    shade:[0.8, '#393D49'],
                    shadeClose:true,
                    area: ["90%","70%"]
                });
            }else if(obj.event=='moneyStatistics'){//资金统计
                layer.open({
                    title:'资金统计',
                    type: 2,
                    content: '/marketing/moneyStatistics?activityId='+data.id,
                    offset: '5px',
                    shade:[0.8, '#393D49'],
                    shadeClose:true,
                    area: ["90%","90%"]
                });
            }
        });

    });






</script>

</body>
</html>
